package cn.youth996.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
 * @author Zhan Xinjian
 * @date 2021/3/6
 */
@Slf4j
@RestController
public class PaymentOrder {
    @Value("${server.port}")
    private String serverPort;

    @GetMapping("/eureka/payment/get")
    public String get() {
        return "eureka provider payment port:" + serverPort + " " + UUID.randomUUID().toString();
    }

    @GetMapping("/eureka/payment/timeOut")
    public String timeOut() {
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return serverPort;
    }
}
